home *** CD-ROM | disk | FTP | other *** search
- /* GNUPLOT - emxvga.trm */
- /*
- * Copyright (C) 1994
- *
- * Permission to use, copy, and distribute this software and its
- * documentation for any purpose with or without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation.
- *
- * Permission to modify the software is granted, but not the right to
- * distribute the modified code. Modifications are to be distributed
- * as patches to released version.
- *
- * This software is provided "as is" without express or implied warranty.
- *
- * This file is included by ../term.c.
- *
- * This terminal driver supports:
- * SVGA 1024x768x256 for PC's running DOS or OS/2
- *
- * AUTHOR
- * David J. Liu (liu@phri.nyu.edu)
- */
-
- /*
- * Compile with GCC (emx) with VESA and SVGAKIT maintained by
- * Johannes Martin (JMARTIN@GOOFY.ZDV.UNI-MAINZ.DE)
- * with additions by David J. Liu (liu@phri.nyu.edu)
- * supports VESA, Trident, Cirrus, ET4000, WD and S3.
- */
-
- /*
- * adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
- */
-
- #ifndef GOT_DRIVER_H
- #include "driver.h"
- #endif
-
- #ifdef TERM_REGISTER
- #ifdef EMXVESA
- register_term(vesa)
- #endif /* VESA */
- register_term(vgal)
- register_term(emxvga)
- #endif
-
- #ifdef TERM_PROTO
- TERM_PUBLIC void EMXVGA_init __P((void));
- TERM_PUBLIC void EMXVGA_reset __P((void));
- TERM_PUBLIC void EMXVGA_text __P((void));
- TERM_PUBLIC void EMXVGA_graphics __P((void));
- TERM_PUBLIC void EMXVGA_linetype __P((int));
- TERM_PUBLIC void EMXVGA_move __P((unsigned int, unsigned int));
- TERM_PUBLIC void EMXVGA_vector __P((unsigned int, unsigned int));
- TERM_PUBLIC int EMXVGA_text_angle __P((int));
- TERM_PUBLIC void EMXVGA_put_text __P((unsigned int, unsigned int, char *));
- #define EMXVGA_VCHAR 8
- #define EMXVGA_HCHAR 8
- #define EMXVGA_VTIC 4
- #define EMXVGA_HTIC 4
- #define EMXVGA_XMAX 0 /* These two entries are just place holders. */
- #define EMXVGA_YMAX 0 /* The actual values will be filled in init. */
-
- #ifdef EMXVESA
- TERM_PUBLIC void EMXVESA_options __P((void));
- TERM_PUBLIC void EMXVESA_init __P((void));
- TERM_PUBLIC void EMXVESA_graphics __P((void));
- TERM_PUBLIC void EMXVESA_text __P((void));
- TERM_PUBLIC void EMXVESA_reset __P((void));
- #endif
-
- #endif /* TERM_PROTO */
-
- #ifndef TERM_PROTO_ONLY
- #ifdef TERM_BODY
- #include <vesa.h>
- #include <graph.h>
- #include <conio.h> /* for getch() -SB */
-
- /*
- * Some versions of graph.h (e.g. jmgraph.h) define RIGHT to be 0
- * colliding with enum JUSTIFY. We don't need this define anyway,
- * just undef it. -SB
- */
- #ifdef RIGHT
- #undef RIGHT
- #endif
-
- static int EMXVGA_vmode=G640x480x256 ; /* default mode */
- static int vgacolor[]={7,8,2,3,4,5,9,14,12,15,13,10,11,1,6} ;
- static int graphics_on=FALSE ;
- int startx,starty,lasty ;
- int EMXVGA_angle,EMXVGA_color ;
- char EMXVGA_chr ;
-
- TERM_PUBLIC void EMXVGA_init ()
- {
- if (!g_mode(EMXVGA_vmode))
- { fprintf (stderr,"Unable to initiate graphics.\n") ; return; }
- term->xmax=g_xsize ;
- term->ymax=g_ysize ;
- lasty=g_ysize-1 ;
- }
-
- TERM_PUBLIC void EMXVGA_reset ()
- {
- g_mode (GTEXT) ; graphics_on=FALSE ;
- }
-
- TERM_PUBLIC void EMXVGA_text ()
- {
- if (graphics_on)
- { VesaGetCharacter (&EMXVGA_chr) ; g_mode (GTEXT) ; graphics_on=FALSE ; }
- }
-
- TERM_PUBLIC void EMXVGA_graphics ()
- {
- if (!graphics_on) { g_mode (EMXVGA_vmode) ; graphics_on=TRUE ; }
- }
-
- TERM_PUBLIC void EMXVGA_linetype (linetype)
- int linetype;
- {
- EMXVGA_color=vgacolor[(linetype%13)+2] ;
- }
-
- TERM_PUBLIC void EMXVGA_move (x,y)
- unsigned int x,y;
- {
- startx=x ; starty=y ;
- }
-
- TERM_PUBLIC void EMXVGA_vector (x,y)
- unsigned int x,y;
- {
- g_line (startx,lasty-starty,x,lasty-y,EMXVGA_color) ;
- startx=x ; starty=y ;
- }
-
- TERM_PUBLIC int EMXVGA_text_angle (ang)
- int ang ;
- {
- EMXVGA_angle=ang*90 ;
- return (TRUE) ;
- }
-
- TERM_PUBLIC void EMXVGA_put_text (x,y,str)
- unsigned int x,y ;
- char *str ;
- {
- g_string (x,lasty-y-3,EMXVGA_color,EMXVGA_angle,str) ;
- }
-
- #ifdef EMXVESA
- int emx_vesamode = G640x480x256;
- int emx_xlast, emx_ylast;
-
- TERM_PUBLIC void EMXVESA_options()
- {
- if (!END_OF_COMMAND) {
- if (almost_equals(c_token,"d$efault")) {
- emx_vesamode = G640x480x256;
- c_token++;
- }
- }
-
- if (!END_OF_COMMAND) {
- /* We have a vesa mode specified */
- struct value a;
- emx_vesamode = (int)real(const_express(&a));
- }
-
- sprintf(term_options,"%d",emx_vesamode);
- }
-
- TERM_PUBLIC void EMXVESA_init()
- {
- if (!g_mode(emx_vesamode))
- int_error("Couldn't select graphics mode",NO_CARET);
- emx_xlast = g_xsize - 1;
- term->xmax = emx_xlast + 1;
- emx_ylast = g_ysize - 1;
- term->ymax = emx_ylast + 1;
- g_mode(GTEXT);
- }
-
- TERM_PUBLIC void EMXVESA_graphics()
- {
- g_mode(emx_vesamode);
- }
-
- TERM_PUBLIC void EMXVESA_text()
- {
- int ch;
- ch = getch();
- g_mode(GTEXT);
- if (ch == 3)
- int_error("Interrupt",NO_CARET);
- }
-
- TERM_PUBLIC void EMXVESA_reset()
- {
- }
- #endif /* VESA */
-
- #endif /* TERM_BODY */
-
- #ifdef TERM_TABLE
-
- #ifdef EMXVESA
- TERM_TABLE_START(vesa_driver)
- "vesa", "IBM PC/Clone with VESA SVGA graphics board [vesa mode]",
- EMXVGA_XMAX, EMXVGA_YMAX, EMXVGA_VCHAR, EMXVGA_HCHAR,
- EMXVGA_VTIC, EMXVGA_HTIC, EMXVESA_options, EMXVESA_init, EMXVESA_reset,
- EMXVESA_text, null_scale, EMXVESA_graphics, EMXVGA_move, EMXVGA_vector,
- EMXVGA_linetype, EMXVGA_put_text, EMXVGA_text_angle,
- null_justify_text, do_point, do_arrow, set_font_null
- TERM_TABLE_END(vesa_driver)
-
- #undef LAST_TERM
- #define LAST_TERM vesa_driver
- #endif /* VESA */
-
- TERM_TABLE_START(vgal_driver)
- "vgal", "IBM PC/Clone with VGA graphics board",
- EMXVGA_XMAX, EMXVGA_YMAX, EMXVGA_VCHAR, EMXVGA_HCHAR,
- EMXVGA_VTIC, EMXVGA_HTIC, options_null, EMXVGA_init, EMXVGA_reset,
- EMXVGA_text, null_scale, EMXVGA_graphics, EMXVGA_move, EMXVGA_vector,
- EMXVGA_linetype, EMXVGA_put_text, EMXVGA_text_angle,
- null_justify_text, do_point, do_arrow, set_font_null
- TERM_TABLE_END(vgal_driver)
-
- #undef LAST_TERM
- #define LAST_TERM vgal_driver
-
- TERM_TABLE_START(emxvga_driver)
- "emxvga", "PC with SuperVGA running DOS or OS/2",
- EMXVGA_XMAX, EMXVGA_YMAX, EMXVGA_VCHAR, EMXVGA_HCHAR,
- EMXVGA_VTIC, EMXVGA_HTIC, options_null, EMXVGA_init, EMXVGA_reset,
- EMXVGA_text, null_scale, EMXVGA_graphics, EMXVGA_move,
- EMXVGA_vector, EMXVGA_linetype, EMXVGA_put_text, EMXVGA_text_angle,
- null_justify_text, do_point, do_arrow, set_font_null
- TERM_TABLE_END(emxvga_driver)
-
- #undef LAST_TERM
- #define LAST_TERM emxvga_driver
-
- #endif /* TERM_TABLE */
- #endif /* TERM_PROTO_ONLY */
-
- #ifdef EMXVESA
- /*
- * NAME: vesa
- *
- * OPTIONS: mode = vesa-mode (default G640x480x256)
- *
- * SUPPORTS: PC with vesa SVGA graphics board.
- *
- * Further Info: Used when compiled with emx-gcc (both DOS and OS/2).
- * Needs VESA and SVGAKIT maintained by
- * Johannes Martin (JMARTIN@GOOFY.ZDV.UNI-MAINZ.DE)
- * with additions by David J. Liu (liu@phri.nyu.edu).
- *
- */
- #endif /* EMXVESA */
-
- /*
- * NAME: vgal
- *
- * OPTIONS: none
- *
- * SUPPORTS: PC with VGA graphics board
- *
- * Further Info: Used when compiled with emx-gcc (both DOS and OS/2).
- * Needs VESA and SVGAKIT maintained by
- * Johannes Martin (JMARTIN@GOOFY.ZDV.UNI-MAINZ.DE)
- * with additions by David J. Liu (liu@phri.nyu.edu).
- *
- */
-
- /*
- * NAME: emxvga
- *
- * OPTIONS: none
- *
- * SUPPORTS: PC with SVGA graphics board
- *
- * Further Info: Used when compiled with emx-gcc (both DOS and OS/2).
- * Needs VESA and SVGAKIT maintained by
- * Johannes Martin (JMARTIN@GOOFY.ZDV.UNI-MAINZ.DE)
- * with additions by David J. Liu (liu@phri.nyu.edu).
- *
- */
-